package com.mingqijia.gassafety.shared.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum ConsumerServiceStatusEnum {

    CONSUMER_SERVICE_STATUS_1(1, "正常"),
    CONSUMER_SERVICE_STATUS_2(2, "到期<=30天"),
    CONSUMER_SERVICE_STATUS_3(3, "到期<=7天"),
    CONSUMER_SERVICE_STATUS_4(4, "期至"),
    CONSUMER_SERVICE_STATUS_5(5, "超期<=7天"),
    CONSUMER_SERVICE_STATUS_6(6, "超期>7天");

    private Integer code;

    private String name;

    private ConsumerServiceStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    // get set 方法
    public Integer getCode() {
        return this.code;
    }

    public String getName() {
        return name;
    }

    public static ConsumerServiceStatusEnum getConsumerServiceStatusEnum(Integer exportCode) {
        if (exportCode == null) {
            return null;
        }
        for (ConsumerServiceStatusEnum code : ConsumerServiceStatusEnum.values()) {
            if (code.code == exportCode) {
                return code;
            }
        }
        return null;
    }
}